<?php
require_once 'adminmenu.php';
?>
<div class="well">
    <h4>List of tags:</h4>
    <hr />
    <table class="table table-striped">
        <thead>
            <tr><th>#</th><th>name</th><th>count</th><th>actions</th></tr>
        </thead>
        <tbody>
            <?php
                $content = new Models_Tags();
                $tags  = $content->getAllTags();
                foreach ($tags as $tag)
                {
                    $countArticles = $content->getArticlesCount($tag['id']);
                    ?>
            <tr><td><?php echo $tag['id']; ?></td><td><a href="/<?php $content->printPath(); ?>articles/tag/<?php echo $tag['id']; ?>"><span class="badge badge-success"><?php echo $tag['name']; ?></span></a></td><td><?php echo $countArticles['count(id)']; ?></td><td>
                                <a class="btn btn-primary btn-mini" href="/<?php $content->printPath(); ?>articles/edittag/<?php echo $tag['id']; ?>"><i class="icon-pencil icon-white"></i></a>
                                <a class="btn btn-danger btn-mini" href="/"><i class="icon-remove icon-white"></i></a>
                            </td></tr>
                     <?php
                }
            ?>
        </tbody>
     </table>
</div>